import java.io.*;

/**
 * User: Aleksey
 * Date: 17.02.2009
 * Time: 23:18:44
 */
public class checklines {
    public static void main(String[] args) {
        File inputFile = new File(args[0]);
        File userOutputFile = new File(args[1]);
        File templateOutputFile = new File(args[2]);

        try {
            System.setOut(new PrintStream(new FileOutputStream("checklinesout.log", true)));
            System.setErr(new PrintStream(new FileOutputStream("checklineserr.log", true)));
        }
        catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        int result = 0;
        try {
            BufferedReader br1 = new BufferedReader(new FileReader(userOutputFile));
            BufferedReader br2 = new BufferedReader(new FileReader(templateOutputFile));

            while (true) {
                String line1 = br1.readLine();
                String line2 = br2.readLine();

                if (line1 == null) {
                    if (line2 != null) {
                        if (line2.length() > 0) {
                            result = 1;
                            break;
                        }
                        line2 = br2.readLine();
                        if (line2 != null) {
                            result = 1;
                            break;
                        }
                    }
                }

                if (line2 == null) {
                     if (line1 != null) {
                        if (line1.length() > 0) {
                            result = 1;
                            break;
                        }
                        line1 = br1.readLine();
                        if (line1 != null) {
                            result = 1;
                            break;
                        }
                    }
                }

                if (line1 == null || line2 == null) {
                    break;
                }

                if (line1.trim().compareTo(line2.trim()) != 0) {
                    result = 1;
                    break;
                }
            }

            br1.close();
            br2.close();
        }
        catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        System.exit(result);
    }
}